﻿<!doctype html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>神州互联办公平台</title>
<link rel="stylesheet" type="text/css" href="/CSS/V3/login/styles.css">
</head>
<body>
<div class="htmleaf-container" style="display:none">
	<div class="wrapper">
		<div class="container">
			<h1 id="v3title">神州互联办公平台V3.0</h1>
			
			<form class="form">
                <input type="text" placeholder="用户名" id="username">
                <input type="password" placeholder="密码" id="userpasd">
				<button type="submit" id="login-button">登陆</button>
			</form>
		</div>
		
		<ul class="bg-bubbles" style="display:none">
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
			<li></li>
		</ul>
	</div>
</div>

<script src="/Scripts/jquery-1.11.2.min.js" type="text/javascript"></script>
    <script src="Scripts/SZHLCommon.js?jsver=5" type="text/javascript"></script>

<script>
function IsPC() {
    var userAgentInfo = navigator.userAgent;
    var Agents = ["Android", "iPhone",
                "SymbianOS", "Windows Phone",
                "iPad", "iPod"];
    var flag = true;
    for (var v = 0; v < Agents.length; v++) {
        if (userAgentInfo.indexOf(Agents[v]) > 0) {
            flag = false;
            break;
        }
    }
    return flag;
}
$(document).ready(function () {
    if (IsPC()) {
        location.href = "login.html";
    } else {
        $(".htmleaf-container").show()
    }
    $("#username").val(ComFunJS.getCookie('username'))
    $("#login-button").click(function (e) {
        e.preventDefault();
        $('form').fadeOut(500);
        $('.wrapper').addClass('form-success');
        $("#v3title").text("正在登陆......")

        $.getJSON('/API/SZHLAPI.ashx?Action=LOGIN', { "password": $("#userpasd").val(), "UserName": $("#username").val() }, function (resultData) {
            if (resultData.ErrorMsg == "") {
                ComFunJS.setCookie('szhlcode', resultData.Result);
                ComFunJS.setCookie('fileapi', resultData.Result1.FileServerUrl);
                location.href = "indexV3.html?ver=" + ComFunJS.getnowdate("yyyy-mm-dd");
                ComFunJS.setCookie('username', $("#username").val(), 2000)
                ComFunJS.setCookie('password', $("#userpasd").val(), 2000)
            } else {
                alert(resultData.ErrorMsg);
                $("#v3title").text("登录失败").css({ "display": "inline" });
                $('form').fadeIn(500);

            }
        })
    });
    if (ComFunJS.getCookie("username") && ComFunJS.getCookie("password")) {
        $("#username").val(ComFunJS.getCookie("username"));
        $("#userpasd").val(ComFunJS.getCookie("password"));
        $("#login-button").trigger('click');
    }
});
</script>

</body>
</html>